<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Title</title>
  <script src="../js/vue-3.2.26.js"></script>
</head>
<body>
<div id="app">
  <hello1></hello1>
  <hello2></hello2>
</div>
</body>
<!-- 使用script分离组件 -->
<script type="text/x-template" id="hello1">
  <h1>hello1</h1>
</script>
<!-- 使用template分离组件 -->
<template id="hello2">
  <h1>hello2</h1>
</template>
<script>
  const App = {
    components: {
      // 根据模板id绑定组件
      'hello1': {
        template: '#hello1',
      },
      'hello2': {
        template: '#hello2',
      }
    }
  }
  const app = Vue.createApp(App).mount("#app");
</script>
</html>
